package com.yutian.springboot.jdbctemplate.biz;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @author zhoulei7
 * @create 2020-09-28
 **/
@Component
public class StudentJdbcBiz {

    @Autowired
    private JdbcTemplate jdbcTemplate;


    public List<Map<String, Object>> get(Long id) {
        List<Map<String, Object>> res = jdbcTemplate.queryForList("SELECT id, `first`, `last`, age FROM testyt.student where id = ?", new Object[]{id});
        return res;
    }
}
